package pso.particle;

import evolution.individual.RealCodedIndividual;

public class Particle extends RealCodedIndividual {
	private ParticleNeighborhood neighborhood;

	private double[] bestPosition;

	private double bestValue;

	private double[] velocity;

	public void positionChanged() {
		this.fitnessCalculated = false;
	}

	public void setPosition(double[] position) {
		setChromosome(position);
		positionChanged();
	}

	public double[] getPosition() {
		return getChromosome();
	}

	@Override
	public void setChromosome(double[] position) {
		super.setChromosome(position);
		positionChanged();
	}

	public ParticleNeighborhood getNeighborhood() {
		return neighborhood;
	}

	public void setNeighborhood(ParticleNeighborhood neighborhood) {
		this.neighborhood = neighborhood;
	}

	public double[] getVelocity() {
		return velocity;
	}

	public void setVelocity(double[] velocity) {
		this.velocity = velocity;
	}

	public double[] getBestPosition() {
		return bestPosition;
	}

	public void setBestPosition(double[] bestPosition) {
		this.bestPosition = bestPosition;
	}

	public double getBestValue() {
		return bestValue;
	}

	public void setBestValue(double bestValue) {
		this.bestValue = bestValue;
	}
}
